<div>
  <img src="/images/CSharpCornerLogo.png" alt="..." width="50" height="50" style="float:left">
</div>
<div class="top-row pl-4 navbar navbar-dark">
  <a class="navbar-brand" href="">Modern Shop</a>
  <button class="navbar-toggler" @onclick="ToggleNavMenu">
    <span class="navbar-toggler-icon"></span>
  </button>
</div>

<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
  <ul class="nav flex-column">

    <AuthorizeView>
      <Authorized>
        <li class="nav-item px-3">
          <NavLink class="nav-link"
                   href="/" Match="NavLinkMatch.All">
            <span class="oi oi-home" aria-hidden="true"></span> Home
          </NavLink>
        </li>
        <li class="nav-item px-3">
          <NavLink class="nav-link" href="products">
            <span class="oi oi-list-rich" aria-hidden="true"></span> Products
          </NavLink>
        </li>
        <li class="nav-item px-3">
          <NavLink class="nav-link" href="items">
            <span class="oi oi-list-rich" aria-hidden="true"></span> Basket
          </NavLink>
        </li>
        <li class="nav-item px-3">
          <NavLink class="nav-link" href="orderhistory">
            <span class="oi oi-list-rich" aria-hidden="true"></span> Order History
          </NavLink>
        </li>
        <li class="nav-item px-3">
          <NavLink class="nav-link"
                   href="/Logout">
            <span class="oi oi-list-rich" aria-hidden="true"></span> Log out
          </NavLink>
        </li>
      </Authorized>
      <NotAuthorized>
        <NavLink class="nav-link"
                 href="/Login">
          <span class="oi oi-list-rich" aria-hidden="true"></span> Log in
        </NavLink>
        <NavLink class="nav-link"
                 href="/Register">
          <span class="oi oi-list-rich" aria-hidden="true"></span> Register
        </NavLink>
      </NotAuthorized>
    </AuthorizeView>


  </ul>
</div>

@code {
  private bool _collapseNavMenu = true;

  private string NavMenuCssClass => _collapseNavMenu ? "collapse" : string.Empty;

  private void ToggleNavMenu()
  {
    _collapseNavMenu = !_collapseNavMenu;
  }
}
